#include<stdio.h>
int x[10000];
int main()
{
    //freopen("in.txt","r",stdin);
    int n;
    scanf("%d",&n);
    for(int i = 0; i < n; i++) scanf("%d",&x[i]);
    for(int i = 1; i < n; i++)
    {
        for(int i = 0; i < n; i++) printf("%d ",x[i]);
        printf("\n");
        int temp = x[i];
        int j = i-1;
        while (j >= 0 && x[j] > temp)
        {
            x[j+1] = x[j];
            j--;
        }
        x[j+1] = temp;
    }
    for(int i = 0; i < n; i++) printf("%d ",x[i]);
        printf("\n");
    return 0;
}